import 'package:demo_proj01/repository/http/httploginterceptor.dart';
import 'package:dio/dio.dart';

class DioInstance {
  final Dio _dio = Dio();
  DioInstance._();

  void initDio({required String baseUrl}) {
    _dio.options = BaseOptions(
      method: "GET",
      baseUrl: baseUrl,
      sendTimeout: Duration(seconds: 30),
      receiveTimeout: Duration(seconds: 30),
    );
    _dio.interceptors.add(HttpLogInteceptor());
  }

  Dio getDio() {
    return _dio;
  }

  static DioInstance? dioInstance;

  static DioInstance instance() {
    return dioInstance ??= DioInstance._();
  }
}
